import jieba
import wordcloud
f = open("社会主义.txt","r",encoding="utf-8")

t = f. read()
f.close()
Is = jieba.Icut(t)

import matplotlib as plt
plt.rcParams['font.sans-serif'] = ['Arial Unicode MS']
plt.rcParams['axes.unicode_minus'] = False


txt	= " ".join(Is)
w = wordcloud.WordCloud(\
    width=1000, height=700,\
   background_color="white",
    font_path="msyh.ttc",max_words = 15
    )
w.generate(txt)
w.to_file("kiki.png")